<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of surat_model
 *
 * @author brlnt
 */
class Login_model extends CI_Model {

    //put your code here
    function Login_model() {
        parent::__construct();
        $this->CI = get_instance();
    }
    
    function validLogin($username, $password){
        $this->db->select('*');
        $this->db->from('loginuser');
        $this->db->where('nama_user', $username);
        $this->db->where('password_user', md5($password));
        $query = $this->db->get();
        if ($query->num_rows() > 0){
            foreach($query->result() as $row){
                $hasil['id'] = $row->idloginuser;
                $hasil['username'] = $row->nama_user;
				$hasil['nama_lengkap'] = $row->nama_lengkap;
                $hasil['role'] = $row->role;
            }
            $hasil['status'] = true;
            return $hasil;
        }else{
            $hasil['status'] = false;
            return $hasil;
        }
    }
    
   
}

?>
